﻿package Application.MapApplication  
{
	import Application.MapApplication.controller.*;
	
	import org.puremvc.as3.core.View;
	import org.puremvc.as3.patterns.facade.Facade;

	/**
	 * Facade模式来实现统一的接口，对外只提供了startup方法用于启动
	 * 在该类被创建的时候会自动调用initializeController方法，需要在该方法中对Command进行注册
	 * 接着，调用startup方法启动（也就是发送一个消息，因为之前已经注册了Command,所以相应的方法会去执行execute进行响应）。
	 * @author ...
	 */
	public class MapApplicationFacade extends Facade
	{
		public static const START_UP:String = "START_UP";

		public static function getInstance(): MapApplicationFacade {
            if (instance == null) {
                instance = new MapApplicationFacade();
            }
            return instance as MapApplicationFacade;
        }
		
		public function startup(app:Object):void
		{	
			sendNotification(START_UP, app);
		}
		
		override protected function initializeController():void {
			
            super.initializeController();
            registerCommand(START_UP, StartUpCmd);
        }
	}
}